<extend name="Public/base"/>


<block name="body">
	<!-- 标题 -->
	<div class="main-title">
		<h2>用户返利申请</h2>
	</div>

	<!-- 按钮工具栏 -->
	<div class="cf">
		<div class="fl">
            <!-- <button class="btn ajax-post" url="{:U('User/changeStatus',array('method'=>'resumeUser'))}" target-form="ids">审核通过</button> -->
        </div>
        <!-- 高级搜索 -->
		<div class="search-form fr">
            <div class="sleft">
                <div class="drop-down">
                    <span id="sch-sort-txt" class="sort-txt" data="{$status}"><if condition="get_apply_status_title($status) eq ''">所有<else/>{:get_apply_status_title($status)}</if></span>
                    <i class="arrow arrow-down"></i>
                    <ul id="sub-sch-menu" class="nav-list hidden">
                        <li><a href="javascript:;" value="">所有</a></li>
                        <li><a href="javascript:;" value="WAITING">等待受理</a></li>
                        <li><a href="javascript:;" value="DEAL">审核通过</a></li>
                        <li><a href="javascript:;" value="REJECT">不通过</a></li>
                    </ul>
                </div>
                <input type="text" name="oid" class="search-input" value="{:I('oid')}" placeholder="请输入订单号">
                <a class="sch-btn" href="javascript:;" id="search" url="{:U('order/apply','',false)}"><i class="btn-search"></i></a>
            </div>
        </div>
    </div>
    

	<!-- 数据表格 -->
    <div class="data-table">
		<table>
            <!-- 表头 -->
            <thead>
                <tr>
                    <th class="row-selected row-selected">
                        <input class="check-all" type="checkbox">
                    </th>
                    <th>#</th>
                    <th>订单编号</th>
                    <th>申请时间</th>
                    <th>用户ID</th>
                    <th>状态</th>
                    <th>操作</th>
                </tr>
            </thead>

            <!-- 列表 -->
            <tbody>
                <notempty name="list">
                <volist name="list" id="data">
                    <tr>
                        <td><input class="ids" type="checkbox" value="{$data['id']}" name="ids[]"></td>
                        <td>{$data.id}</td>
                        <td>{$data.orders}</td>
                        <td>{$data.applyAt|format_time}</td>
                        <td>{$data.client}</td>
                        <td>{$data.status|get_apply_status_title}</td>
                        <td>
                            <a href="{:U('Order/apply_handle')}&id={$data.id}">
                                <if condition="$data.status eq 'WAITING'">
                                    去受理
                                <else/>
                                    查看
                                </if>
                            </a>
                        </td>
                    </tr>
                </volist>
                <else/>
                <td colspan="7" class="text-center"> aOh! 暂时还没有内容! </td>
                </notempty>
            </tbody>
        </table>
	</div>
	<!-- 分页 -->
    <div class="page">
        {$_page}
    </div>
</div>

</block>
<block name="script">
<script type="text/javascript">
    $(function(){
        //搜索功能
        $("#search").click(function(){
            var url = $(this).attr('url');
            var status = $("#sch-sort-txt").attr("data");
            var query  = $('.search-form').find('input').serialize();
            query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
            query = query.replace(/^&/g,'');
            if(status != ''){
                query += 'status=' + status + "&" + query;
            }
            if( url.indexOf('?')>0 ){
                url += '&' + query;
            }else{
                url += '?' + query;
            }
            window.location.href = url;
        });
    
        /* 状态搜索子菜单 */
        $(".search-form").find(".drop-down").hover(function(){
            $("#sub-sch-menu").removeClass("hidden");
        },function(){
            $("#sub-sch-menu").addClass("hidden");
        });
        $("#sub-sch-menu li").find("a").each(function(){
            $(this).click(function(){
                var text = $(this).text();
                $("#sch-sort-txt").text(text).attr("data",$(this).attr("value"));
                $("#sub-sch-menu").addClass("hidden");
            })
        });
    
        //回车自动提交
        $('.search-form').find('input').keyup(function(event){
            if(event.keyCode===13){
                $("#search").click();
            }
        });
        
    })
</script>
            
</block>
